﻿<UserControl x:Class="FeedNews.Views.SettingView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="{Binding ViewHeight}" d:DesignWidth="{Binding ViewWidth}">
    <Grid>
        <Border Margin="40">
            <ScrollViewer 
                Width="Auto"
                Height="Auto"
                Template="{DynamicResource ScrollViewerControlTemplate}" >
                <StackPanel>
                    <!-- Feed List -->
                    <TextBlock 
                        Foreground="#FF938888" 
                        FontFamily="Verdana" 
                        FontSize="24" 
                        FontWeight="Bold">RSS FEED LIST</TextBlock>
                    <Grid Height="220" Margin="10">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="50"/>
                        </Grid.RowDefinitions>
                        <Grid Grid.Row="0">
                            <DataGrid 
                                Margin="5,0,5,0"
                                ItemsSource="{Binding MyRSSList}" 
                                SelectedItem="{Binding thisItem}"
                                AutoGenerateColumns="False" 
                                AlternatingRowBackground="Gainsboro"  
                                AlternationCount="2"
                               >
                                <DataGrid.Columns>                                    
                                    <DataGridTextColumn Header="Name" Binding="{Binding Name}" />
                                    <DataGridTextColumn Header="Url" Binding="{Binding Uri}" Width="*"/>
                                </DataGrid.Columns>
                            </DataGrid>
                        </Grid>
                        <Grid Grid.Row="1" VerticalAlignment="Center">
                            <Button 
                            Width="Auto"
                            Height="Auto"
                            Margin="10,0,0,0"
                            VerticalAlignment="Bottom"
                            HorizontalAlignment="Left"
                            Style="{StaticResource IconButtonStyle}"
                            Command="{Binding DeleteItem}">
                                <Image Style="{StaticResource DeleteStyle}"/>
                            </Button>
                            <Button 
                            Width="Auto"
                            Height="Auto"
                            Margin="0,0,10,0"
                            VerticalAlignment="Bottom"
                            HorizontalAlignment="Right"
                            Style="{StaticResource IconButtonStyle}"
                            Command="{Binding SaveItem}">
                                <Image Style="{StaticResource SaveStyle}"/>
                            </Button>
                    </Grid>
                    </Grid>
                    <TextBlock                        
                        Foreground="#FF938888" 
                        FontFamily="Verdana" 
                        FontSize="24" 
                        FontWeight="Bold">Add RSS FEED</TextBlock>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid Grid.Column="0" >
                            <StackPanel>
                                <TextBlock Text="Name" Margin="10" Foreground="#FF938888"/>
                                <TextBlock Text="RSS Url" Margin="10" Foreground="#FF938888" />
                            </StackPanel>
                        </Grid>
                        <Grid Grid.Column="1">
                            <StackPanel>
                                <TextBox Width="300" Margin="10" Text="{Binding itemName}"></TextBox>
                                <TextBox Width="300" Margin="10" Text="{Binding itemUrl}"></TextBox>
                            </StackPanel>
                        </Grid>
                        <Grid Grid.Column="2">
                            <Button 
                                Width="Auto"
                                Height="Auto"
                                Margin="10"
                                VerticalAlignment="Center"
                                HorizontalAlignment="Center"
                                Style="{StaticResource IconButtonStyle}"
                                Command="{Binding AddItem}">
                                <Image Style="{StaticResource AddStyle}"/>
                            </Button>
                        </Grid>
                    </Grid>
                </StackPanel>
            </ScrollViewer> 
        </Border>
    </Grid>
</UserControl>
